<?php
namespace app\horoscope\controller;

class Shensha extends \think\Controller
{
    // 神煞
    private $shensha = [
        '华盖' => [
            '寅' => '戌',
            '午' => '戌',
            '戌' => '戌',
            '亥' => '未',
            '卯' => '未',
            '未' => '未',
            '申' => '辰',
            '子' => '辰',
            '辰' => '辰',
            '巳' => '丑',
            '酉' => '丑',
            '丑' => '丑',
        ],
        '桃花' => [
            '寅' => '卯',
            '午' => '卯',
            '戌' => '卯',
            '亥' => '子',
            '卯' => '子',
            '未' => '子',
            '申' => '酉',
            '子' => '酉',
            '辰' => '酉',
            '巳' => '午',
            '酉' => '午',
            '丑' => '午',
        ],
        '驿马' => [
            '寅' => '申',
            '午' => '申',
            '戌' => '申',
            '亥' => '巳',
            '卯' => '巳',
            '未' => '巳',
            '申' => '寅',
            '子' => '寅',
            '辰' => '寅',
            '巳' => '亥',
            '酉' => '亥',
            '丑' => '亥',
        ],
        '亡神' => [
            '寅' => '巳',
            '午' => '巳',
            '戌' => '巳',
            '亥' => '寅',
            '卯' => '寅',
            '未' => '寅',
            '申' => '亥',
            '子' => '亥',
            '辰' => '亥',
            '巳' => '申',
            '酉' => '申',
            '丑' => '申',
        ],
        '将星' => [
            '寅' => '午',
            '午' => '午',
            '戌' => '午',
            '亥' => '卯',
            '卯' => '卯',
            '未' => '卯',
            '申' => '子',
            '子' => '子',
            '辰' => '子',
            '巳' => '酉',
            '酉' => '酉',
            '丑' => '酉',
        ],

        '天乙贵人' => [
            '甲' => ['丑', '未'],
            '乙' => ['子', '申'],
            '丙' => ['酉', '亥'],
            '丁' => ['酉', '亥'],
            '戊' => ['丑', '未'],
            '己' => ['子', '申'],
            '庚' => ['丑', '未'],
            '辛' => ['寅', '午'],
            '壬' => ['巳', '卯'],
            '癸' => ['巳', '卯'],
        ],
        '天德贵人' => [
            '寅' => '丁',
            '卯' => '申',
            '辰' => '壬',
            '巳' => '辛',
            '午' => '亥',
            '未' => '甲',
            '申' => '癸',
            '酉' => '寅',
            '戌' => '丙',
            '亥' => '乙',
            '子' => '巳',
            '丑' => '庚',
        ],
        '文昌贵人' => [
            '甲' => '巳',
            '乙' => '午',
            '丙' => '申',
            '丁' => '酉',
            '戊' => '申',
            '己' => '酉',
            '庚' => '亥',
            '辛' => '子',
            '壬' => '寅',
            '癸' => '卯',
        ],
        '月德贵人' => [
            '申' => '壬',
            '子' => '壬',
            '辰' => '壬',
            '寅' => '丙',
            '午' => '丙',
            '戌' => '丙',
            '巳' => '庚',
            '酉' => '庚',
            '丑' => '庚',
            '亥' => '甲',
            '卯' => '甲',
            '未' => '甲',
        ],
        '金舆' => [
            '甲' => '辰',
            '乙' => '巳',
            '丙' => '未',
            '丁' => '申',
            '戊' => '未',
            '己' => '申',
            '庚' => '戌',
            '辛' => '亥',
            '壬' => '丑',
            '癸' => '寅',
        ],
        '红艳煞' => [
            '甲' => '午',
            '乙' => '申',
            '丙' => '寅',
            '丁' => '未',
            '戊' => '辰',
            '己' => '辰',
            '庚' => '申',
            '辛' => '酉',
            '壬' => '子',
            '癸' => '戌',
        ],
        '孤辰' => [
            '亥' => '寅',
            '子' => '寅',
            '丑' => '寅',
            '寅' => '巳',
            '卯' => '巳',
            '辰' => '巳',
            '巳' => '申',
            '午' => '申',
            '未' => '申',
            '申' => '亥',
            '酉' => '亥',
            '戌' => '亥',
        ],
        '寡宿' => [
            '亥' => '戌',
            '子' => '戌',
            '丑' => '戌',
            '寅' => '丑',
            '卯' => '丑',
            '辰' => '丑',
            '巳' => '辰',
            '午' => '辰',
            '未' => '辰',
            '申' => '未',
            '酉' => '未',
            '戌' => '未',
        ],
        '禄神' => [
            '甲' => '寅',
            '乙' => '卯',
            '丙' => '巳',
            '丁' => '午',
            '戊' => '巳',
            '己' => '午',
            '庚' => '申',
            '辛' => '酉',
            '壬' => '亥',
            '癸' => '子',
        ],
        '羊刃' => [
            '甲' => '卯',
            '乙' => '辰',
            '丙' => '午',
            '丁' => '未',
            '戊' => '午',
            '己' => '未',
            '庚' => '酉',
            '辛' => '戌',
            '壬' => '子',
            '癸' => '丑',
        ],
        '金神' => [
            '癸酉', '己巳', '乙丑'
        ],
    ];

    private $bazi = [
        1=>'甲',2=>'戌',
        3=>'丙',4=>'子',
        5=>'丁',6=>'亥',
        7=>'丁',8=>'未'
    ];

    public function __construct()
    {

    }

    public function getShensha()
    {
        $huagai = $this->is_huagai();
        $taohua = $this->is_taohua();
        $yima = $this->is_yima();
        $wangshen = $this->is_wangshen();
        $jiesha = $this->is_jiesha();
        $jiangxing = $this->is_jiangxing();
        $zaisha = $this->is_zaisha();
        $tianyiguiren = $this->is_tianyiguiren();
        $tiandeguiren = $this->is_tiandeguiren();
        $wenchangguiren = $this->is_wenchangguiren();
        $yuedeguiren = $this->is_yuedeguiren();
        $jinyu = $this->is_jinyu();
        $hongyansha = $this->is_hongyansha();
        $guchen = $this->is_guchen();
        $guaxiu = $this->is_guaxiu();
        $lushen = $this->is_lushen();
        $yangren = $this->is_yangren();
        $jinshen = $this->is_jinshen();
        $shensha = array_merge($huagai,$taohua,$yima,$wangshen,$jiesha,$jiangxing,$zaisha,$tianyiguiren,$tiandeguiren,$wenchangguiren,$yuedeguiren,$jinyu,$hongyansha,$guchen,$guaxiu,$lushen,$yangren,$jinshen);

        return json(['code'=>200,'data'=>$shensha,'msg'=>'Success.']);

    }

    private function is_huagai()
    {
        $ret = [];
        $rizhi_nianzhi = [
            ['寅','午','戌'],
            ['亥','卯','未'],
            ['申','子','辰'],
            ['巳','酉','丑'],
        ];
        $jian = ['戌','未','辰','丑'];
        foreach($rizhi_nianzhi as $k=> $rn)
        {
            if(in_array($this->bazi[6],$rn))
            {
                if($this->bazi[2] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'华盖',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'年支',
                        'location_num'=>2,
                    ];
                }
                elseif($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'华盖',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'华盖',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
            elseif(in_array($this->bazi[2],$rn))
            {
                if($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'华盖',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[6] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'华盖',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'华盖',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_taohua()
    {
        $ret = [];
        $rizhi_nianzhi = [
            ['寅','午','戌'],
            ['亥','卯','未'],
            ['申','子','辰'],
            ['巳','酉','丑'],
        ];
        $jian = ['卯','子','酉','午'];
        foreach($rizhi_nianzhi as $k=> $rn)
        {
            if(in_array($this->bazi[6],$rn))
            {
                if($this->bazi[2] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'桃花',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'年支',
                        'location_num'=>2,
                    ];
                }
                elseif($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'桃花',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'桃花',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
            elseif(in_array($this->bazi[2],$rn))
            {
                if($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'桃花',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[6] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'桃花',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'桃花',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_yima()
    {
        $ret = [];
        $rizhi_nianzhi = [
            ['寅','午','戌'],
            ['亥','卯','未'],
            ['申','子','辰'],
            ['巳','酉','丑'],
        ];
        $jian = ['申','巳','寅','亥'];
        foreach($rizhi_nianzhi as $k=> $rn)
        {
            if(in_array($this->bazi[6],$rn))
            {
                if($this->bazi[2] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'驿马',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'年支',
                        'location_num'=>2,
                    ];
                }
                elseif($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'驿马',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'驿马',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
            elseif(in_array($this->bazi[2],$rn))
            {
                if($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'驿马',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[6] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'驿马',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'驿马',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_wangshen()
    {
        $ret = [];
        $rizhi_nianzhi = [
            ['寅','午','戌'],
            ['亥','卯','未'],
            ['申','子','辰'],
            ['巳','酉','丑'],
        ];
        $jian = ['巳','寅','亥','申'];
        foreach($rizhi_nianzhi as $k=> $rn)
        {
            if(in_array($this->bazi[6],$rn))
            {
                if($this->bazi[2] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'亡神',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'年支',
                        'location_num'=>2,
                    ];
                }
                elseif($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'亡神',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'亡神',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
            elseif(in_array($this->bazi[2],$rn))
            {
                if($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'亡神',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[6] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'亡神',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'亡神',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_jiesha()
    {
        $rizhi_nianzhi = [
            ['寅','午','戌'],
            ['亥','卯','未'],
            ['申','子','辰'],
            ['巳','酉','丑'],
        ];
        $jian = ['亥','申','巳','寅'];
        foreach($rizhi_nianzhi as $k=> $rn)
        {
            if(in_array($this->bazi[6],$rn))
            {
                if($this->bazi[2] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'劫煞',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'年支',
                        'location_num'=>2,
                    ];
                }
                elseif($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'劫煞',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'劫煞',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
            elseif(in_array($this->bazi[2],$rn))
            {
                if($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'劫煞',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[6] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'劫煞',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'劫煞',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_jiangxing()
    {
        $ret = [];
        $rizhi_nianzhi = [
            ['寅','午','戌'],
            ['亥','卯','未'],
            ['申','子','辰'],
            ['巳','酉','丑'],
        ];
        $jian = ['午','卯','子','酉'];
        foreach($rizhi_nianzhi as $k=> $rn)
        {
            if(in_array($this->bazi[6],$rn))
            {
                if($this->bazi[2] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'将星',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'年支',
                        'location_num'=>2,
                    ];
                }
                elseif($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'将星',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'将星',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
            elseif(in_array($this->bazi[2],$rn))
            {
                if($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'将星',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[6] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'将星',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'将星',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_zaisha()
    {
        $ret = [];
        $rizhi_nianzhi = [
            ['寅','午','戌'],
            ['亥','卯','未'],
            ['申','子','辰'],
            ['巳','酉','丑'],
        ];
        $jian = ['子','酉','午','卯'];
        foreach($rizhi_nianzhi as $k=> $rn)
        {
            if(in_array($this->bazi[6],$rn))
            {
                if($this->bazi[2] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'灾煞',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'年支',
                        'location_num'=>2,
                    ];
                }
                elseif($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'灾煞',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'灾煞',
                        'condition'=>$this->bazi[6].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
            elseif(in_array($this->bazi[2],$rn))
            {
                if($this->bazi[4] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'灾煞',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif($this->bazi[6] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'灾煞',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $jian[$k])
                {
                    $ret[] = [
                        'name'=>'灾煞',
                        'condition'=>$this->bazi[2].$jian[$k],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_tianyiguiren()
    {
        $ret = [];
        $tygr = $this->shensha['天乙贵人'];
        foreach($tygr as $k => $t)
        {
            if($this->bazi[1] == $k)
            {
                if(in_array($this->bazi[6],$t))
                {
                    $ret[] = [
                        'name'=>'天乙贵人',
                        'condition'=>$this->bazi[1].$this->bazi[6],
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif(in_array($this->bazi[8],$t))
                {
                    $ret[] = [
                        'name'=>'天乙贵人',
                        'condition'=>$this->bazi[1].$this->bazi[8],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
            elseif($this->bazi[5] == $k)
            {
                if(in_array($this->bazi[2],$t))
                {
                    $ret[] = [
                        'name'=>'天乙贵人',
                        'condition'=>$this->bazi[5].$this->bazi[2],
                        'location_cn'=>'年支',
                        'location_num'=>2,
                    ];
                }
                elseif(in_array($this->bazi[4],$t))
                {
                    $ret[] = [
                        'name'=>'天乙贵人',
                        'condition'=>$this->bazi[5].$this->bazi[4],
                        'location_cn'=>'月支',
                        'location_num'=>4,
                    ];
                }
                elseif(in_array($this->bazi[6],$t))
                {
                    $ret[] = [
                        'name'=>'天乙贵人',
                        'condition'=>$this->bazi[5].$this->bazi[6],
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif(in_array($this->bazi[8],$t))
                {
                    $ret[] = [
                        'name'=>'天乙贵人',
                        'condition'=>$this->bazi[5].$this->bazi[8],
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_tiandeguiren()
    {
        $ret = [];
        $tdgr = $this->shensha['天德贵人'];
        foreach($tdgr as $k => $t)
        {
            if($this->bazi[4] == $k)
            {
                if($this->bazi[5] == $t)
                {
                    $ret[] = [
                        'name'=>'天德贵人',
                        'condition'=>$k.$t,
                        'location_cn'=>'日干',
                        'location_num'=>5,
                    ];
                }
                elseif($this->bazi[6] == $t)
                {
                    $ret[] = [
                        'name'=>'天德贵人',
                        'condition'=>$k.$t,
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[7] == $t)
                {
                    $ret[] = [
                        'name'=>'天德贵人',
                        'condition'=>$k.$t,
                        'location_cn'=>'时干',
                        'location_num'=>7,
                    ];
                }
                elseif($this->bazi[8] == $t)
                {
                    $ret[] = [
                        'name'=>'天德贵人',
                        'condition'=>$k.$t,
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_wenchangguiren()
    {
        $ret = [];
        $wcgr = $this->shensha['文昌贵人'];
        foreach($wcgr as $k => $t)
        {
            if($this->bazi[5] == $k)
            {
                if($this->bazi[2] == $t)
                {
                    $ret[] = [
                        'name'=>'文昌贵人',
                        'condition'=>$k.$t,
                        'location_cn'=>'年支',
                        'location_num'=>5,
                    ];
                }
                elseif($this->bazi[4] == $t)
                {
                    $ret[] = [
                        'name'=>'文昌贵人',
                        'condition'=>$k.$t,
                        'location_cn'=>'月支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[6] == $t)
                {
                    $ret[] = [
                        'name'=>'文昌贵人',
                        'condition'=>$k.$t,
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $t)
                {
                    $ret[] = [
                        'name'=>'文昌贵人',
                        'condition'=>$k.$t,
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_yuedeguiren()
    {
        $ret = [];
        $ydgr = $this->shensha['月德贵人'];
        foreach($ydgr as $k => $t)
        {
            if($this->bazi[4] == $k)
            {
                if($this->bazi[5] == $t)
                {
                    $ret[] = [
                        'name'=>'月德贵人',
                        'condition'=>$k.$t,
                        'location_cn'=>'日干',
                        'location_num'=>5,
                    ];
                }
                elseif($this->bazi[7] == $t)
                {
                    $ret[] = [
                        'name'=>'月德贵人',
                        'condition'=>$k.$t,
                        'location_cn'=>'时干',
                        'location_num'=>7,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_jinyu()
    {
        $ret = [];
        $jy = $this->shensha['金舆'];
        foreach($jy as $k => $t)
        {
            if($this->bazi[5] == $k)
            {
                if($this->bazi[5] == $k)
                {
                    if($this->bazi[2] == $t)
                    {
                        $ret[] = [
                            'name'=>'金舆',
                            'condition'=>$k.$t,
                            'location_cn'=>'年支',
                            'location_num'=>5,
                        ];
                    }
                    elseif($this->bazi[4] == $t)
                    {
                        $ret[] = [
                            'name'=>'金舆',
                            'condition'=>$k.$t,
                            'location_cn'=>'月支',
                            'location_num'=>6,
                        ];
                    }
                    elseif($this->bazi[6] == $t)
                    {
                        $ret[] = [
                            'name'=>'金舆',
                            'condition'=>$k.$t,
                            'location_cn'=>'日支',
                            'location_num'=>6,
                        ];
                    }
                    elseif($this->bazi[8] == $t)
                    {
                        $ret[] = [
                            'name'=>'金舆',
                            'condition'=>$k.$t,
                            'location_cn'=>'时支',
                            'location_num'=>8,
                        ];
                    }
                }
            }
        }
        return $ret;
    }

    private function is_hongyansha()
    {
        $ret = [];
        $hys = $this->shensha['红艳煞'];
        foreach($hys as $k => $t)
        {
            if($this->bazi[5] == $k)
            {
                if($this->bazi[2] == $t)
                {
                    $ret[] = [
                        'name'=>'红艳煞',
                        'condition'=>$k.$t,
                        'location_cn'=>'年支',
                        'location_num'=>5,
                    ];
                }
                elseif($this->bazi[4] == $t)
                {
                    $ret[] = [
                        'name'=>'红艳煞',
                        'condition'=>$k.$t,
                        'location_cn'=>'月支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[6] == $t)
                {
                    $ret[] = [
                        'name'=>'红艳煞',
                        'condition'=>$k.$t,
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $t)
                {
                    $ret[] = [
                        'name'=>'红艳煞',
                        'condition'=>$k.$t,
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_guchen()
    {
        $ret = [];
        $gc = $this->shensha['孤辰'];
        foreach($gc as $k => $t)
        {
            if($this->bazi[2] == $k)
            {
                if($this->bazi[6] == $t)
                {
                    $ret[] = [
                        'name'=>'孤辰',
                        'condition'=>$k.$t,
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $t)
                {
                    $ret[] = [
                        'name'=>'孤辰',
                        'condition'=>$k.$t,
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_guaxiu()
    {
        $ret = [];
        $gx = $this->shensha['寡宿'];
        foreach($gx as $k => $t)
        {
            if($this->bazi[2] == $k)
            {
                if($this->bazi[6] == $t)
                {
                    $ret[] = [
                        'name'=>'寡宿',
                        'condition'=>$k.$t,
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $t)
                {
                    $ret[] = [
                        'name'=>'寡宿',
                        'condition'=>$k.$t,
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_lushen()
    {
        $ret = [];
        $lx = $this->shensha['禄神'];
        foreach($lx as $k => $t)
        {
            if($this->bazi[5] == $k)
            {
                if($this->bazi[2] == $t)
                {
                    $ret[] = [
                        'name'=>'禄神',
                        'condition'=>$k.$t,
                        'location_cn'=>'年支',
                        'location_num'=>5,
                    ];
                }
                elseif($this->bazi[4] == $t)
                {
                    $ret[] = [
                        'name'=>'禄神',
                        'condition'=>$k.$t,
                        'location_cn'=>'月支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[6] == $t)
                {
                    $ret[] = [
                        'name'=>'禄神',
                        'condition'=>$k.$t,
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $t)
                {
                    $ret[] = [
                        'name'=>'禄神',
                        'condition'=>$k.$t,
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_yangren()
    {
        $ret = [];
        $yr = $this->shensha['羊刃'];
        foreach($yr as $k => $t)
        {
            if($this->bazi[5] == $k)
            {
                if($this->bazi[2] == $t)
                {
                    $ret[] = [
                        'name'=>'羊刃',
                        'condition'=>$k.$t,
                        'location_cn'=>'年支',
                        'location_num'=>5,
                    ];
                }
                elseif($this->bazi[4] ==$t)
                {
                    $ret[] = [
                        'name'=>'羊刃',
                        'condition'=>$k.$t,
                        'location_cn'=>'月支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[6] == $t)
                {
                    $ret[] = [
                        'name'=>'羊刃',
                        'condition'=>$k.$t,
                        'location_cn'=>'日支',
                        'location_num'=>6,
                    ];
                }
                elseif($this->bazi[8] == $t)
                {
                    $ret[] = [
                        'name'=>'羊刃',
                        'condition'=>$k.$t,
                        'location_cn'=>'时支',
                        'location_num'=>8,
                    ];
                }
            }
        }
        return $ret;
    }

    private function is_jinshen()
    {
        $ret = [];
        $jinshen = $this->shensha['金神'];
        foreach($jinshen as $k => $t)
        {
            $riganzhi = $this->bazi[5] . $this->bazi[6];
            $shiganzhi = $this->bazi[7] . $this->bazi[8];
            if($riganzhi == $t)
            {
                $ret[] = [
                    'name'=>'金神',
                    'condition'=>$t,
                    'location_cn'=>'日支',
                    'location_num'=>6,
                ];
            }
            elseif($shiganzhi == $t)
            {
                $ret[] = [
                    'name'=>'金神',
                    'condition'=>$t,
                    'location_cn'=>'时支',
                    'location_num'=>8,
                ];
            }
        }
        return $ret;
    }
}